<?php
/**
 * CreateTime: 2024/1/16 15:09
 * User:LinQ
 */

namespace App\Http\Controllers\Address;

use App\Http\Controllers\BasicInterfaceController;
use App\Http\Requests\Address\AddressRequest;
use App\Http\Service\Address\AddressService;

class AddressController implements BasicInterfaceController
{
    public function getCurrentAddress(){
        (new AddressService())->getCurrentAddress();
    }

    public function setDefaultAddress($addressId){
        (new AddressService())->setDefaultAddress($addressId);
    }

    public function getList()
    {

    }

    public function getSelect()
    {

    }

    public function getSelectHasPage()
    {

    }

    public function getInfo($id)
    {

    }

    public function create()
    {
        $data = request()->only(
            'recipient_name',
                 'phone_number',
                 'city',
                 'state',
                 'address_line',
                 'postal_code',
                 'is_default',
        );
        (new AddressRequest())->check($data);
        (new AddressService())->create($data);
    }

    public function fakeDelete($id)
    {
        (new AddressService())->fakeDelete($id);
    }

    public function fakeDeleteByIds($ids)
    {

    }

    public function delete()
    {

    }

    public function update($id)
    {
        $data = request()->only(
            'recipient_name',
            'phone_number',
            'city',
            'state',
            'address_line',
            'postal_code'
        );
        $data['customer_id'] = $id;
        (new AddressService())->update($data);
    }
}
